package com.intct.jedis;

import redis.clients.jedis.Jedis;

import java.util.HashMap;
import java.util.Map;

/**
 * @author gufg
 * @since 2025-06-20 15:29
 */
public class JedisUtil {
    public static void main(String[] args) {
        // 连接Redis  redis服务地址 + 端口 + [用户] + [密码]
        Jedis jedis = new Jedis("jd-node", 6379);
        jedis.auth("123456");

        Map<String, Double> scoreMembers = new HashMap<>();
        scoreMembers.put("m10", 2D);
        scoreMembers.put("m20", 1D);
        scoreMembers.put("m30", 3D);
        scoreMembers.put("m40", 4D);

        // 操作有序集合
        jedis.zadd("jedis_zadd_key", scoreMembers);

        // 关闭
        jedis.close();
    }
}
